<?php
class Controller_App_Task extends Controller_App_Template
{
    public function __construct ($req, $res)
    {
        $this->template = "smarty:app/service/blank";
        parent::__construct($req, $res);
    }

    public function action_index ()
    {
        //
    }
    
    /**
     * 获取某个福利下的任务列表
     */
    public function action_list($pid)
    {
        $uid = $this->_uid;
        $list = App_Task::get_list($uid, $pid);
//        var_dump($list);exit;
        $this->template->set('list', $list);
        $this->template->set('pid', $pid);
        $this->template->set_filename("smarty:app/test/tasklist");
    }
    
    /**
     * 获取已经结束的福利列表
     */
    public function action_finish_task($pid, $tid)
    {
        $uid = $this->_uid;
        App_Task::finish_task($uid, $pid, $tid);
        $this->request->redirect('/task/list/'.$pid);
    }
    
    public function action_start_task($pid, $tid)
    {
        $uid = $this->_uid;
        App_Task::start_task($uid, $pid, $tid);
        $this->request->redirect('/task/list/'.$pid);
    }
    
    /**
     * 展示某个福利对应的任务
     * @param type $pid
     */
    public function action_task_list($pid)
    {
        
    }

}
